package com.shenjies88.practice.mcpclient.config;

import jakarta.annotation.Resource;
import lombok.AllArgsConstructor;
import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.client.advisor.SimpleLoggerAdvisor;
import org.springframework.ai.ollama.OllamaChatModel;
import org.springframework.ai.tool.ToolCallbackProvider;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author by shenjies88
 * @since 2025/9/13 19:28
 */
@AllArgsConstructor
@Configuration
public class ChatClientConfig {

    @Resource(name = "qwen3ChatModel")
    private final OllamaChatModel qwen3ChatModel;

    private final ToolCallbackProvider toolCallbackProvider;


    @Bean
    public ChatClient qwen3ChatClient() {
        return ChatClient.builder(qwen3ChatModel)
                .defaultAdvisors(new SimpleLoggerAdvisor())
                .defaultToolCallbacks(toolCallbackProvider).build();
    }

}
